package com.zhang.listen;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;


@Component
public class RabbitMQListener {


    //监听指定队列
    @RabbitListener(queues = "q1")
    public void listenerQueue(Message message){
        System.out.println("消费者1收到消息: "+new String(message.getBody()));
    }

}



